window.onload=function(){

    var mydiv=document.querySelector(".mydiv");
    var as=document.querySelectorAll(".xg");
    for (var i = 0; i < as.length; i++) {
        as[i].onclick=function(){
            console.log(this);
            mydiv.style.display='block';
            document.forms[1].action="../UserTopic/Teacher03_in";
            var tr= this.parentNode.parentNode;
            var tds=tr.children;
            var inps=document.querySelectorAll(".mymf input");
            for(var k=0;k<4;k++){
                console.log("点击事件触发");
                // if(k==1){
                //     continue;
                // }
                inps[k].value=tds[k].innerHTML;
                console.log(tds[k].innerHTML);


            }

        }
    }
    var gb=document.querySelector(".gb");
    gb.onclick=function(){
        mydiv.style.display='none';
    }

}

function showadd(){
    var mydiv2=document.querySelector(".mydiv2");
    mydiv2.style.display='block';

    var tj_fk = document.querySelector("#tj_fk");

    //获取添加框里的值
    var t_class = document.querySelector("#t_class");
    var t_name = document.querySelector("#t_name");
    // var t_img = document.getElementsByClassName(".t_img");
    var t_class_bc = document.querySelector("#t_class_bc");
    var t_name_bc = document.querySelector("#t_name_bc");
    tj_fk.onsubmit = function (){
        // alert("ce");
        if(t_class.value ==""){
            t_class_bc.innerHTML = "班级不能为空";
            return false;
        }else{
            t_class_bc.style.display = "none";
        }
        if(t_name.value == ""){
            t_name_bc.innerHTML = "姓名不能为空";
            return false;
        }else{
            t_name_bc.style.display = "none";
            return true;
        }

    }

    var gb2=document.querySelector(".gb2");
    gb2.onclick=function(){
        mydiv2.style.display='none';
    }
}